package com.waimai.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.waimai.service.RestaurantService;

@Controller("restaurantcontroller")
@RequestMapping("/restaurant")
public class RestaurantController {
	@Resource(name = "restaurantservice")
	private RestaurantService restaurantservice;

	@RequestMapping("/allrest.htm")
	public String showRestaurant(HttpServletRequest request, String address,
			String company, String drink) {
		request.setAttribute("list", restaurantservice.getAllRestaurantByItems(
				address, company, drink));
		boolean  flag = true;
		/*for(int a=0;a<100000;a++){
		while(flag){
			restaurantservice.getAllRestaurantByItems(
					address, company, drink);
		}*/
		HttpSession session = request.getSession();
		System.out.println(address +"===="+company+"====="+drink);
		session.setAttribute("address", address);
		session.setAttribute("company", company);
		session.setAttribute("drink", drink);
		return "../restlist";
	}
}
